import java.util.Scanner;

/**
 * @author vivi
 * @description
 * @date 2024/5/10
 */
public class demo1 {
    public static void main (String[] args) {
        Scanner scanner = new Scanner(System.in);
        char[] a = scanner.next().toCharArray();
        char[] b = scanner.next().toCharArray();
        int lenA = a.length;
        int lenB = b.length;

        int ret = lenA;

        for (int i = 0; i <= lenB-lenA; i++) {
            int tmp = 0;
            for (int j = 0; j < lenA; j++) {
                if(a[j] != b[i + j]){
                    tmp++;
                }
            }
            ret = Math.min(ret, tmp);
        }
        System.out.println(ret);
    }
}
